package com.itheima.aop;


import com.itheima.pojo.Result;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;

@Component
@Slf4j
@Aspect
public class MyAspectResult {


    @Around("@annotation(com.itheima.anno.MyLog3)")
    public Object myAspectResult(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {



        long begin = System.currentTimeMillis();
        //调用原始方法
        Object obj = proceedingJoinPoint.proceed();
        long end = System.currentTimeMillis();
//操作耗时
        Long costTime = end - begin;
//获取登录结果,是否成功
        log.info("这个值:{}",costTime);

        return obj;
    }
}
